package com.jt.redis.demos;

import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
@Component
public class IdGenerator {
    @Resource(name="stringRedisTemplate")
    private ValueOperations valueOperations;

    public Long generatorId(){
        return valueOperations.increment("id");
    }
}
